﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;

namespace BioinformaticAlgoritms2014
{
   public static class Tools
    {
        internal static string GetFullPath(string relativePath)
        {
            return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), relativePath);
        }
        internal static int[] ParseStringToIntArray(string src)
        {
            return src.Split(' ').Select(a => int.Parse(a)).ToArray();
        }

        internal static bool CompareArray<T>(T[] arr1, T[] arr2)
        {
            return arr1.Length == arr2.Length && arr1.All(a => arr2.Contains(a));
        }
        internal static IEnumerable<string> Split(this string str, int chunkSize)
        {
            return Enumerable.Range(0, str.Length / chunkSize)
                .Select(i => str.Substring(i * chunkSize, chunkSize));
        }

       private static int Fact(int x)
       {
           return (x == 0) ? 1 : x * Fact(x - 1);
       }
    }
}
